﻿CREATE TABLE [dbo].[QuanTri_CapQuyenNguoiDungSuDungMenu] (
    [ID]            INT IDENTITY (1, 1) NOT NULL,
    [MaNhomUser]    INT NULL,
    [MaNhomMenuND]  INT NULL,
    [MaChuongTrinh] INT NULL,
    [IDViTri]       INT NULL,
    PRIMARY KEY CLUSTERED ([ID] ASC),
    CONSTRAINT [FK_QuanTri_CapQuyenNguoiDungSuDungMenu_DanhMuc_ChuongTrinh] FOREIGN KEY ([MaChuongTrinh]) REFERENCES [dbo].[DanhMuc_ChuongTrinh] ([MaChuongTrinh]) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT [FK_QuanTri_CapQuyenNguoiDungSuDungMenu_DanhMuc_NhomMenuNguoiDung] FOREIGN KEY ([MaNhomMenuND]) REFERENCES [dbo].[DanhMuc_NhomMenuNguoiDung] ([MaNhomMenuND]) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT [FK_QuanTri_CapQuyenNguoiDungSuDungMenu_DanhMuc_NhomNguoiDung] FOREIGN KEY ([MaNhomUser]) REFERENCES [dbo].[DanhMuc_NhomNguoiDung] ([MaNhomUser]) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT [FK_QuanTri_CapQuyenNguoiDungSuDungMenu_DanhMuc_ViTriMenu] FOREIGN KEY ([IDViTri]) REFERENCES [dbo].[DanhMuc_ViTriMenu] ([IDViTri]) ON DELETE CASCADE ON UPDATE CASCADE
);

